
total_cost = float(input())         # total_cost为当前房价
annual_salary = float(input())        # 年薪
portion_saved = float(input()) / 100  # 月存款比例，输入30转为30%
semi_annual_raise = float(input()) /100     # 输入每半年加薪比例，输入7转化为7%

portion_down_payment = 0.3      # 首付比例，浮点数
down_payment = portion_down_payment * total_cost   # 首付款
print('首付',down_payment)

current_savings = 0                                # 存款金额，从0开始
number_of_months = 0
monthly_salary = annual_salary/12 #月工资
monthly_deposit = monthly_salary * portion_saved               # 月存款
# 计算多少个月才能存够首付款，结果为整数，不足1月按1个月计算，即向上取整
while current_savings < down_payment:
    number_of_months = number_of_months + 1
    current_savings = current_savings + monthly_deposit # 加1后马上存入存款金额，7，13月份加入的金额是上次循环新计算的存款金额。
    if number_of_months%6==0:
        monthly_salary=monthly_salary*(1+semi_annual_raise)
        monthly_deposit = monthly_salary * portion_saved
    if number_of_months % 12 == 0:
        print("第{}个月月末有{:,.0f}元存款".format(number_of_months, current_savings))
    #print(number_of_months, '当前存款', current_savings)

#print(number_of_months)
print(f'需要{number_of_months}个月可以存够首付')
